cmake_minimum_required(VERSION 3.1)

project(weixun)

# 设置默认构建类型为 Release
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Release)
endif()

# 可执行文件目录
# set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

# 设置C++11标准
set(CMAKE_CXX_STANDARD 11)

set(CMAKE_CXX_STANDARD_REQUIRED True)

# 头文件搜索路径包含include头文件和第三方库头文件路径
include_directories(
    ${PROJECT_SOURCE_DIR}/include
    ${PROJECT_SOURCE_DIR}/3rdparty
)

# 递归搜索src目录下的所有.cpp文件并加入到SRC变量中
file(GLOB_RECURSE SRC src/*.cpp)

# 将src下的cpp文件全部编译
add_executable(weixun ${SRC})

# 链接动态链接库
target_link_libraries(weixun
    pthread
    ${PROJECT_SOURCE_DIR}/3rdparty/cppwinks/lib/libnetwork.so
    ${PROJECT_SOURCE_DIR}/3rdparty/cppwinks/lib/libutility.so
    ${PROJECT_SOURCE_DIR}/3rdparty/cppwinks/lib/libmysql.so
    ${PROJECT_SOURCE_DIR}/3rdparty/mysql/lib/libmysqlclient.so
)
